﻿    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Uber.Core.Model.Post>" %>

    <div id="q<%=Model.Id %>" class="question ext" data-val="<%=Model.Id %>">
        <div style="display: none;" class="editor">
            <ul class="errlist">
            </ul>
            <% if (Model.ParentId == null)
               {%>
            <table class="et">
                <tr>
                    <td style="width: 100px;">
                        <label for="Title" class="elabel">
                            Title:</label>
                    </td>
                    <td>
                        <div style="margin-right: 27px;">
                            <input type="text" class="title" name="Title" value="<%=Model.Title %>" />
                            <input type="text" class="btitle" style="display: none;" />
                        </div>
                    </td>
                </tr>
            </table>
            <%}%>
            <div class="efield" style="margin: 5px;">
                <div class="toolbox">
                    <button type="button" data-v='*'>
                        B</button>
                    <button type="button" data-v='_'>
                        I</button>
                    <button type="button" data-v='code'>
                        {code}</button>
                </div>
                <textarea class="body" rows="10" cols="20" style="width: 100%;"><%:Model.Body %></textarea>
                <textarea class="bbody" rows="1" cols="1" style="display: none;"></textarea>
            </div>
            <div class="efield" style="margin: 5px;">
                <input type="button" value="Save Changes" class="grbtn btn-save" />
                <input type="button" value="Cancel" class="grbtn btn-cancel" />
            </div>
            <div style='border: 1px dashed gainsboro;' class='preview'>
            </div>
        </div>
        <div class="pb">
        </div>
        <% Html.RenderPartial("qf", Model); %>
        <div>       
            <ul class="comments">
                <%foreach (var c in Model.Comments.OrderBy(o => o.CreationDate))
                  {Html.RenderPartial("comment",c);} %>
            </ul>
            <%if(Request.IsAuthenticated){%>
             <a href="" class="graylink">add comment</a>
            <div class="commentbox hid">
                <textarea cols="20" rows="2" class="newcomment"></textarea>
                <input type="button" value="Add Comment" class="addcomment grbtn" />
                <input type="button" value="Cancel" class="cancelcomment grbtn"/>
                <div class="errcomm">
                </div>
            </div>
            <%} %>
        </div>
    </div>
